package com.lwc.backendsinglestructure.domain.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 用户 实体类。
 *
 * @author <a href="https://gitee.com/liu-wenchan">程序员Rel</a>
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("user")
public class User implements Serializable {

    @Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
    private Long id;

    @Column("username")
    private String username;

    @Column("password")
    private String password;

    @Column("sex")
    private Integer sex;

    @Column("role")
    private String role;

    @Column("nick_name")
    private String nickName;

    @Column("email")
    private String email;

    @Column("phone")
    private String phone;

    @Column("open_id")
    private String openId;

    @Column("invite_code")
    private String inviteCode;

    @Column("invited_id")
    private Long invitedId;

    @Column("id_card")
    private String idCard;

    @Column("is_certified")
    private String isCertified;

    @Column("status")
    private Integer status;

    @Column("login_ip")
    private String loginIp;

    @Column("last_login_time")
    private LocalDateTime lastLoginTime;

    @Column(value = "create_time",onInsertValue = "CURRENT_TIMESTAMP")
    private LocalDateTime createTime;

    @Column(value = "update_time",onUpdateValue = "CURRENT_TIMESTAMP",onInsertValue = "CURRENT_TIMESTAMP")
    private LocalDateTime updateTime;

    @Column(value = "is_delete",isLogicDelete = true)
    private Integer isDelete;

}
